package com.flashshe.ds.linear
{
	public class VectorQueue extends AbstractQueue
	{
		private var data:Vector.<Object> = new Vector.<Object>();
		
		public function VectorQueue()
		{
			super();
		}
		
		public override function enqueue(v:Object):void
		{
			data.push(v);
		}
		
		public override function dequeue():Object
		{			
			return data.splice(0, 1);
		}
		
		public override function peek():Object
		{
			if (data.length > 0)
			{
				return data[0];
			}
			
			return null;
		}
		
		public override function get size():int
		{
			return data.length;
		}
		
		public override function contains(v:Object):Boolean
		{
			return (data.indexOf(v) == -1) ? false : true;
		}	
		
		public override function clear():void
		{
			data = new Vector.<Object>();
		}
	}
}